import { Server } from 'socket.io'
import { ChatService } from './services/chat/ChatService'
import { DanmakuService } from './services/danmaku/DanmakuService'

export const initializeSocketServer = (io: Server) => {
  // 初始化各种Socket服务
  new ChatService(io)
  new DanmakuService(io)

  // 处理连接
  io.on('connection', (socket) => {
    console.log('Client connected:', socket.id)

    socket.on('disconnect', () => {
      console.log('Client disconnected:', socket.id)
    })
  })

  return io
}
